How QuickDraw GX Defines Objects
Objects are specialized data structures. Some of the data structures used by operating systems such as the Macintosh Operating System are public--that is, your application can manipulate the values of their fields directly. Many of the data structures used by QuickDraw GX, on the other hand, are not public. These private data structures are called objects and the accessible pieces of information inside them are called properties. Your application creates and modifies objects to perform tasks, but it may not manipulate object properties directly. Instead, QuickDraw GX provides functions that manipulate them for you.QuickDraw GX does not provide pointers or handles for you to locate objects. Instead, it provides reference values. To allow type checking in C and Pascal, QuickDraw GX defines references as pointers to structures, although the reference is not guaranteed to point to anything. For example, a shape object is identified by a shape reference:
typedef struct gxPrivateShapeRecord *gxShape;The contents of the structure are private. To obtain information about an object, you must send its reference as a parameter to a QuickDraw GX function.When you create an object, you call a
GXNewObject
function that returns a reference to the object. Conversely, you can dispose of an object you no longer need by passing its reference in a call toGXDisposeObject
. For example, you can create a picture shape object by calling theGXNewShape
function with a parameter that specifies that you want the shape to be a picture type:
myShape = GXNewShape(gxPictureType);In this example,myShape
is a reference to the shape object, returned by the function. When you are finished with the object, you dispose of it like this:
GXDisposeShape(myShape);QuickDraw GX objects exist in a memory area (QuickDraw GX memory) that is separate from the application's memory. For more information on QuickDraw GX memory, see "Objects and Memory" beginning on page 1-18.QuickDraw GX defines its objects in a device-independent manner. Because of that, and because many of its data structures are private, the QuickDraw GX software and the hardware on which it runs can evolve without disrupting existing applications.